package com.study.spmongodb.wwj.thread2.char05;

/**
 * @author MI
 * @version 1.0
 * @date 2020/12/7 21:26
 */
public class User extends Thread {
    private final String myNmae;
    private final String myAddress;

    private final Gate gate;

    public User(String myNmae, String myAddress, Gate gate) {
        this.myNmae = myNmae;
        this.myAddress = myAddress;
        this.gate = gate;
    }

    @Override
    public void run() {
        System.out.println(myNmae + " BEGIN");
        while (true) {
            this.gate.pass(myNmae, myAddress);
        }
    }
}
